home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / update~4.z / update~4 / lib_stdio_vsprintf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  740 b   |  38 lines

  1. /*                v s p r i n t f
  2.  *
  3.  * This function provides the same functionality as sprintf except
  4.  * that it uses varargs.h.
  5.  *
  6.  * Patchlevel 1.0
  7.  *
  8.  * Edit History:
  9.  * 05-Sep-1989  Minor adjustments for Gnu C (actually any ansi C) ++jrb
  10.  * 03-Sep-1989    Changed to PUTC() since no chance of line buffering.
  11.  */
  12.  
  13. #include "stdiolib.h"
  14.  
  15. /*LINTLIBRARY*/
  16.  
  17. int vsprintf(buf, fmt, args)
  18.  
  19. char       *buf;                /* output buffer */
  20. CONST char *fmt;                /* format */
  21. va_list    args;                /* argument list */
  22.  
  23. {
  24.   int v;                /* return value */
  25.   FILE f;                /* temporary file */
  26.  
  27.   f._flag   = _IOWRITE | _IOSTRING;
  28.   f._base   = (unsigned char *) buf;
  29.   f._bufsiz = 0;
  30.  
  31.   INITWRITEBUFFER(&f);
  32.  
  33.   v = vfprintf(&f, fmt, args);
  34.   (void) PUTC(0, &f);
  35.  
  36.   return v;
  37. }
  38.